
public class Liczba {
	private final int Max_System = 16;
	private final String pattern = "0123456789ABCDEF";
	public String convertTo(int n, int base)
	{
	   String result = "";
	   if ((base > Max_System) || (base < 2))
	      return null;
	   if (n == 0)
	      return "0";
	   while (n>0)
	   {
	      result = pattern.charAt(n % base) + result;
	      n /= base;
	   }

	   return result;
	}

}
